package com.swyc.osschat.Test.shijianlun.listener;

import com.swyc.osschat.Common.Util.JsonUtils;
import com.swyc.osschat.Common.Util.SpringUtils;
import com.swyc.osschat.Test.shijianlun.AbstractNettyDelayQueueListener;
import com.swyc.osschat.Test.shijianlun.TaskVO;
import com.swyc.osschat.Test.shijianlun.entity.OrderInfo;
import com.swyc.osschat.Test.shijianlun.service.OrderService;
import com.swyc.osschat.Test.shijianlun.service.impl.OrderServiceImpl;
import lombok.extern.slf4j.Slf4j;

/**
 * @description TODO
 * @Author: z156940l@outlook.com
 * @className PayOrderCancelWithNettyListener
 * @Date: 2023/3/14 16:46
 */
@Slf4j
public class PayOrderCancelWithNettyListener extends AbstractNettyDelayQueueListener<OrderInfo> {
    @Override
    protected void execute(TaskVO<OrderInfo> taskVO) {
        try {
            OrderInfo orderInfo = taskVO.getData();
//            SpringUtils.getBean(OrderService.class).cancelOrder(orderInfo);
            OrderService orderService = new OrderServiceImpl();
            orderService.cancelOrder(orderInfo);
            log.info("延时支付取消订单成功！Data:{}", JsonUtils.toJson(orderInfo));
        }catch (Exception e){
            log.error("延时支付取消订单失败！errMsg:{}", e.getMessage());
        }
    }
}
